﻿using System;
using System.Drawing;

namespace Microsoft.Office.PowerPoint.STAMP.Controls
{
    /// <summary>
    /// Wraps a <see cref="FontFamily"/> and exposes it's name in ToString().
    /// </summary>
    public class FontDropDownItem
    {
        private static readonly FontDropDownItem _empty = new FontDropDownItem();

        /// <summary>
        /// Gets an empty instance.
        /// </summary>
        public static FontDropDownItem Empty
        {
            get { return _empty; }
        }

        /// <summary>
        /// Gets a value indicating whether this instance is empty.
        /// </summary>
        public bool IsEmpty { get { return this == _empty; } }

        private readonly FontFamily _family;

        private FontDropDownItem()
        {
            
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="FontDropDownItem"/> class.
        /// </summary>
        /// <param name="family">The family.</param>
        public FontDropDownItem(FontFamily family)
        {
            _family = family;
        }

        /// <summary>
        /// Gets the family.
        /// </summary>
        public FontFamily Family
        {
            get { return _family; }
        }

        /// <summary>
        /// Gets the name.
        /// </summary>
        public string Name
        {
            get { return IsEmpty ? "" : Family.Name; }
        }

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            return Name;
        }
    }
}